﻿using DapperExtensions.Mapper;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;

namespace MaximServices.Model
{
    public class DateDetail
    {
        [Key]
        [Column("id")]
        public string Id { get; set; }

        [Column("target_date")]
        public DateTime Target_Date { get; set; }
        [Column("rule_id")]
        public string Rule_Id { get; set; }
    }

    public class DateDetailMapper : ClassMapper<DateDetail>
    {
        public DateDetailMapper()
        {
            //use different table name
            Table("date_detail");

            //use a custom schema
            Schema("");

            //have a custom primary key
            Map(x => x.Id).Column("id").Key(KeyType.Assigned);

            Map(x => x.Target_Date).Column("target_date");
            Map(x => x.Rule_Id).Column("rule_id");

            //optional, map all other columns
            AutoMap();
        }
    }
}
